package com.tac.controller.wms;

import com.github.pagehelper.PageInfo;
import com.tac.common.result.Result;
import com.tac.pojo.wms.Material;
import com.tac.service.wms.MaterialService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping("/material")
@RestController
@CrossOrigin
@Api(tags = "智能仓储WMS--物料档案")
public class MaterialController {

    @Autowired
    private MaterialService materialService;

    //查看物料列表
    @ApiOperation("查看物料列表")
    @GetMapping("/getList")
    public Result<PageInfo<Material>> getList(Integer pageNum, Integer pageSize, Integer typeId, Integer code, String name, String model, String specifications){
        return materialService.getList(pageNum,pageSize,typeId,code,name,model,specifications);
    }

    @ApiOperation("添加物料列表")
    @PostMapping("/save")
    public Result save(@RequestBody Material material){
        return materialService.save(material);
    }
    @DeleteMapping("remove")
    @ApiOperation("删除物料列表")
    public Result remove(@RequestBody List<Integer> ids){
        return materialService.remove(ids);
    }
    @PutMapping("/update")
    @ApiOperation("修改物料列表")
    public  Result update(@RequestBody Material material){
        return materialService.update(material);
    }
}
